// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   DisclaimerPanel.java

package com.boci.common.ui.control;

import com.boci.clientapp.main.ApplicationService;
import com.boci.clientapp.main.ClientAppLoader;
import com.boci.common.constant.ClientAppConst;
import com.boci.common.util.*;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Locale;
import java.util.logging.Logger;
import javax.swing.*;

// Referenced classes of package com.boci.common.ui.control:
//            CMURLButton

public class DisclaimerPanel extends JPanel
    implements ActionListener
{

    public DisclaimerPanel(Locale pLocale, boolean pDialogFlag)
    {
        initGUI(pLocale, pDialogFlag);
        setText(pLocale);
    }

    public DisclaimerPanel(Locale pLocale)
    {
        this(pLocale, false);
    }

    public void setText(Locale pLocale)
    {
        MessagesConfigurator msgConfigurator = ClientAppLoader.getMessagesConfigurator();
        lblDisclaimer1.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER1", pLocale));
        btnDisclaimer2.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER2", pLocale));
        lblDisclaimer3.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER3", pLocale));
        btnDisclaimer4.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER4", pLocale));
        lblDisclaimer5.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER5", pLocale));
        lblDisclaimer6.setText((new StringBuilder()).append(" ").append(msgConfigurator.getUIMessages("COMMON.DISCLAIMER6", pLocale)).append(" ").toString());
        lblDisclaimer7.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER7", pLocale));
        btnDisclaimer8.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER8", pLocale));
        lblDisclaimer9.setText(msgConfigurator.getUIMessages("COMMON.DISCLAIMER9", pLocale));
        setFont(pLocale);
    }

    private void setFont(Locale pLocale)
    {
        lblDisclaimer1.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        btnDisclaimer2.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        lblDisclaimer3.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        btnDisclaimer4.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        lblDisclaimer5.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        lblDisclaimer6.setFont(ClientAppLoader.getSymbolFont());
        lblDisclaimer7.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
        btnDisclaimer8.setFont(ClientAppLoader.getDisclaimerFont(ClientAppConst.EN_US));
        lblDisclaimer9.setFont(ClientAppLoader.getDisclaimerFont(pLocale));
    }

    public void initGUI(Locale pLocale, boolean pDialogFlag)
    {
        setOpaque(false);
        lblDisclaimer1 = new JLabel();
        btnDisclaimer2 = new CMURLButton();
        lblDisclaimer3 = new JLabel();
        btnDisclaimer4 = new CMURLButton();
        lblDisclaimer5 = new JLabel();
        lblDisclaimer6 = new JLabel();
        lblDisclaimer7 = new JLabel();
        btnDisclaimer8 = new CMURLButton();
        lblDisclaimer9 = new JLabel();
        lblDisclaimer1.setMinimumSize(new Dimension(0, 15));
        btnDisclaimer2.setMinimumSize(new Dimension(0, 15));
        lblDisclaimer3.setMinimumSize(new Dimension(0, 15));
        btnDisclaimer4.setMinimumSize(new Dimension(0, 15));
        lblDisclaimer5.setMinimumSize(new Dimension(0, 15));
        lblDisclaimer6.setMinimumSize(new Dimension(0, 15));
        lblDisclaimer7.setMinimumSize(new Dimension(0, 15));
        btnDisclaimer8.setMinimumSize(new Dimension(0, 15));
        lblDisclaimer9.setMinimumSize(new Dimension(0, 15));
        btnDisclaimer2.setActionCommand("DISCLAIMER_DLG");
        btnDisclaimer2.addActionListener(this);
        btnDisclaimer4.setActionCommand("SECURITY_DLG");
        btnDisclaimer4.addActionListener(this);
        btnDisclaimer8.setActionCommand("BOCI_URL");
        btnDisclaimer8.addActionListener(this);
        if(!pDialogFlag)
        {
            setLayout(new FlowLayout(1, 0, 0));
            setPreferredSize(new Dimension(710, 16));
            add(lblDisclaimer1);
            add(btnDisclaimer2);
            add(lblDisclaimer3);
            add(btnDisclaimer4);
            add(lblDisclaimer5);
            add(lblDisclaimer6);
            add(lblDisclaimer7);
            add(btnDisclaimer8);
            add(lblDisclaimer9);
        } else
        {
            setPreferredSize(new Dimension(0, 28));
            JPanel friLinePanel = new JPanel();
            JPanel secLinePanel = new JPanel();
            friLinePanel.setOpaque(false);
            secLinePanel.setOpaque(false);
            friLinePanel.setPreferredSize(new Dimension(0, 10));
            secLinePanel.setPreferredSize(new Dimension(0, 10));
            friLinePanel.setLayout(new FlowLayout(1, 0, -3));
            secLinePanel.setLayout(new FlowLayout(1, 0, -3));
            friLinePanel.add(lblDisclaimer1);
            friLinePanel.add(btnDisclaimer2);
            friLinePanel.add(lblDisclaimer3);
            friLinePanel.add(btnDisclaimer4);
            friLinePanel.add(lblDisclaimer5);
            secLinePanel.add(lblDisclaimer6);
            secLinePanel.add(lblDisclaimer7);
            secLinePanel.add(btnDisclaimer8);
            secLinePanel.add(lblDisclaimer9);
            setLayout(new BoxLayout(this, 1));
            add(friLinePanel);
            add(secLinePanel);
        }
    }

    public void actionPerformed(ActionEvent e)
    {
        String strActionType = e.getActionCommand();
        Logger logger = CMLogger.getInstance();
        ApplicationService appServ = ApplicationService.getInstance();
        if(strActionType.equals("BOCI_URL"))
            try
            {
                appServ.showBOCILink();
            }
            catch(Exception sysEx)
            {
                logger.severe(StringUtil.formatException(sysEx));
            }
        else
        if(strActionType.equals("DISCLAIMER_DLG"))
            appServ.showDisclaimerDialog(true);
        else
        if(strActionType.equals("SECURITY_DLG"))
            appServ.showSecurityDialog(true);
    }

    private JLabel lblDisclaimer1;
    private CMURLButton btnDisclaimer2;
    private JLabel lblDisclaimer3;
    private CMURLButton btnDisclaimer4;
    private JLabel lblDisclaimer5;
    private JLabel lblDisclaimer6;
    private JLabel lblDisclaimer7;
    private CMURLButton btnDisclaimer8;
    private JLabel lblDisclaimer9;
}
